<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<%@ include file="/web/header.jsp"%>
<title>用户登录</title>
</head>
<body>
	<fieldset class="layui-elem-field" style="margin: 20px; padding: 20px;">
		<legend>用户登录：</legend>
		<form class="layui-form layui-form-pane" method="post">
			<div class="layui-form-item">
				<label class="layui-form-label">账号：</label>
				<div class="layui-input-inline">
					<input type="text" name="code" class="layui-input" lay-verify="required" placeholder="请输入账号" style="width: 15rem;">
				</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label">密码：</label>
				<div class="layui-input-inline">
					<input type="text" name="pass" required class="layui-input" lay-verify="required" placeholder="请输入密码" style="width: 15rem;">
				</div>
			</div>
			<div class="layui-form-item">
				<div class="layui-input-inline">
					<input value="登录" type="button" class="layui-btn" lay-submit lay-filter="login" />
					<input value="重置" type="reset" class="layui-btn layui-btn-primary" />
				</div>
				<input value="注册" type="button" class="layui-btn" onclick="g0JspReg()" />
			</div>
			<input type="hidden" name="action" value="login" />
		</form>
	</fieldset>
</body>

<script type="text/javascript">
	formSubmit('/EmployeeServlet', 'submit(login)', 'text', function(data) {
		if (data == 0) {
			layer.msg("账号不存在~");
		} else if (data == 2) {
			layer.msg("密码错误");
		} else {
			layer.msg("恭喜你，成功登录")
			goJspSystem();
		}
	})

	// 	var form = layui.form;
	// 	var $ = layui.jquery;
	// 	var layer = layui.layer;
	// 	form.on("submit(login)", function(data) {
	// 		$.ajax({
	// 			url : "/work/EmployeeServlet",
	// 			data : data.field,
	// 			type : "post",
	// 			dataType : "text",
	// 			success : function(data) {
	// 				if (data == 0) {
	// 					layer.msg("账号不存在~");
	// 				} else if (data == 2) {
	// 					layer.msg("密码错误");
	// 				} else {
	// 					layer.msg("恭喜你，成功登录", function() {
	// 						goJsp("/web/page/system.jsp")
	// 					})
	// 				}
	// 			}
	// 		})
	// 	})
</script>
</html>